﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="UserManage.aspx.cs" Inherits="MobileServer.Web.Admin.UserManage" %>
<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        DataKeyNames="Id" DataSourceID="SqlDataSource1" EnableModelValidation="True" 
        Height="50px" Width="125px" DefaultMode="Insert">
        <Fields>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="LoginId" HeaderText="LoginId" 
                SortExpression="LoginId" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="MobilePhone" HeaderText="MobilePhone" 
                SortExpression="MobilePhone" />
            <asp:BoundField DataField="IM" HeaderText="IM" SortExpression="IM" />
            <asp:CommandField ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="Id" DataSourceID="SqlDataSource1" EnableModelValidation="True">
        <Columns>
            <asp:CommandField ShowEditButton="True" />
            <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                SortExpression="Id" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
            <asp:BoundField DataField="Position" HeaderText="Position" 
                SortExpression="Position" />
            <asp:BoundField DataField="LoginId" HeaderText="LoginId" 
                SortExpression="LoginId" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="MobilePhone" HeaderText="MobilePhone" 
                SortExpression="MobilePhone" />
            <asp:BoundField DataField="IM" HeaderText="IM" SortExpression="IM" />
            <asp:BoundField DataField="Status" HeaderText="Status" 
                SortExpression="Status" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DefaultDB %>" 
        DeleteCommand="DELETE FROM [SEC_User] WHERE [Id] = @Id" 
        InsertCommand="INSERT INTO [SEC_User] ( [Name], [LoginId], [Email], [MobilePhone], [IM]) VALUES (@Name,@LoginId, @Email, @MobilePhone, @IM)" 
        SelectCommand="SELECT [Id], [Name], [Type], [Position], [LoginId], [Email], [MobilePhone], [IM], [Status] FROM [SEC_User] ORDER BY NAME" 
        UpdateCommand="UPDATE [SEC_User] SET [Name] = @Name, [Type] = @Type, [Position] = @Position, [LoginId] = @LoginId, [Email] = @Email, [MobilePhone] = @MobilePhone, [IM] = @IM, [Status] = @Status WHERE [Id] = @Id">
        <DeleteParameters>
            <asp:Parameter Name="Id" Type="Object" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="LoginId" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="MobilePhone" Type="String" />
            <asp:Parameter Name="IM" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Type" Type="String" />
            <asp:Parameter Name="Position" Type="String" />
            <asp:Parameter Name="LoginId" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="MobilePhone" Type="String" />
            <asp:Parameter Name="IM" Type="String" />
            <asp:Parameter Name="Status" Type="String" />
            <asp:Parameter Name="Id" Type="Object" />
        </UpdateParameters>
    </asp:SqlDataSource>
    
</asp:Content>
